<template>
    <div class="orderRecord-page">
        <div class="page-line">
            <RadioButtonGroupM line v-model="tabActive" :list="tabList" />
            <!-- <div class="cell-title">订单记录</div> -->
            <!-- <AdminSearchGroupM @search="onSearch" /> -->
        </div>

        <div class="order-list" v-if="filterList.length">
            <div class="order-item" v-for="item in renderList" :key="item.id">
                <div class="order-item__image">
                    <img
                        :src="
                            item.info
                                ? item.info.file +
                                  '?x-oss-process=image/watermark,image_' +
                                  toBase64(
                                      'water/logo_white.png?x-oss-process=image/resize,P_30'
                                  ) +
                                  ',g_center,t_60'
                                : ''
                        "
                    />
                </div>

                <div class="order-item__info">
                    <div class="order-item__top">
                        <div class="order-item__title">
                            {{ item.info ? item.info.name : "" }}
                        </div>
                        <div class="order-item__price">¥{{ item.price }}</div>
                    </div>

                    <div class="order-item__main">
                        订单ID：{{ item.order_no }}
                    </div>

                    <div class="order-item__footer">
                        <div class="order-item__buy-time">
                            购买时间：{{
                                formatDate(item.paytime, "YYYY-MM-DD")
                            }}
                        </div>
                        <div class="order-item__validity">有效期：1年</div>
                        <var-tooltip
                            :content="item.temspecs ? item.temspecs.name : ''"
                        >
                            <div class="order-item__version">
                                版本：{{ item.temspecs?.name || "-" }}
                            </div>
                        </var-tooltip>
                    </div>
                </div>
            </div>
        </div>
        <el-empty :image-size="150" v-else />
    </div>
</template>
<script setup>
import { useContent } from ".";
const {
    tabActive,
    tabList,
    filterList,
    pagination,
    renderList,
    GetList,
    onSearch,
} = useContent();

onMounted(async () => {
    GetList();
});
</script>
<style lang="scss" scoped>
.page-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    margin-bottom: 15px;
}

.cell-title {
    position: relative;
    color: #5085fb;
    font-size: 14px;
    padding-left: 8px;
    font-weight: 500;

    &::before {
        content: "";
        position: absolute;
        top: 50%;
        left: 0;
        width: 3px;
        height: 13px;
        border-radius: 20px;
        background-color: #5085fb;
        transform: translateY(-50%);
    }
}

.order-list {
    padding: 0 15px 15px;

    .order-item {
        width: 345px;
        background-color: #fff;
        padding: 5px;
        margin-bottom: 15px;
        border-radius: 3px;
        overflow: hidden;

        &:last-of-type {
            margin-bottom: 0;
        }

        &__info {
            padding: 8px 8px 12px 5px;
        }

        &__image {
            width: 335px;
            height: 125px;
            border-radius: 3px;
            overflow: hidden;

            img {
                width: 100%;
                height: 100%;
                object-fit: cover;
            }
        }

        &__top {
            display: flex;
            align-items: center;
        }

        &__title {
            width: 220px;
            font-size: 16px;
            color: #333;
            font-weight: bold;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }

        &__price {
            font-size: 18px;
            color: #5085fb;
            font-weight: 500;
            margin-left: auto;
        }

        &__main {
            color: #999;
            font-size: 13px;
            margin-top: 18px;
        }

        &__footer {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-top: 15px;
            font-size: 12px;
            color: #999;
        }

        &__version {
            width: 100px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
    }
}
</style>
